package cn.wolfcode.controller;

import cn.wolfcode.domain.StrategyTheme;
import cn.wolfcode.query.QueryObject;
import cn.wolfcode.service.IDestinationService;
import cn.wolfcode.service.IStrategyThemeService;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @Description: 攻略主体控制器类
 * @Author: 伍家钰
 * @Date: 2020/8/10 10:40
 * @Version: 1.0
 */
@Controller
@RequestMapping("strategyTheme")
public class StrategyThemeController {
    @Resource
    private IStrategyThemeService strategyThemeService;
    @Resource
    private IDestinationService destinationService;

    /**
     * 分页查询
     *
     * @param model
     * @param qo
     * @return
     */
    @RequestMapping("list")
    public String list(Model model, @ModelAttribute("qo") QueryObject qo) {
        Page<StrategyTheme> page = strategyThemeService.query(qo);
        model.addAttribute("page", page);
        return "strategyTheme/list";
    }

    /**
     * 查询目的地数据
     *
     * @return
     */
    @RequestMapping("listDests")
    @ResponseBody
    public Object listDests() {
        return destinationService.list();
    }


}
